<?php
echo $this->Form->input('id', array('type' => 'hidden'));
echo $this->Form->input('title', array('type' => 'hidden'));
echo $this->Form->input('description', array('type' => 'hidden'));
echo $this->Form->input('target_user', array('type' => 'hidden'));
echo $this->Form->input('course_type', array('type' => 'hidden'));
echo $this->Form->input('category', array('type' => 'hidden'));
echo $this->Form->input('area', array('type' => 'hidden'));
echo $this->Form->input('tag', array('type' => 'hidden'));
echo $this->Form->input('price', array('type' => 'hidden'));
echo $this->Form->input('course_image01', array('type' => 'hidden'));
echo $this->Form->input('course_image02', array('type' => 'hidden'));
echo $this->Form->input('course_image03', array('type' => 'hidden'));
if (empty($course['Course']['course_image02'])) {
	echo $this->Form->input('delete_image02', array('type' => 'hidden', 'value' => 1));
}
if (empty($course['Course']['course_image03'])) {
	echo $this->Form->input('delete_image03', array('type' => 'hidden', 'value' => 1));
}
//for course detail
if(isset($course['CourseDetail'])){
	echo $this->Form->input('CourseDetail.opening_date', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.closing_date', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.area', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.zip01', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.zip02', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.address01', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.address02', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.place_name', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.address_flg', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.attend_total', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.price', array('type' => 'hidden'));
	echo $this->Form->input('CourseDetail.notice', array('type' => 'hidden'));
}
?>

<table class="scheduleForm">
	<tr>
		<td class="left">タイトル</td>
		<td class="courseTitle">
			<?php if (isset ($course['Course']['title'])):?>
			<?php echo $course['Course']['title'];?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">クラスの内容について</td><td class="courseDescription">
			<?php if (isset ($course['Course']['description'])):?>
				<?php echo nl2br($course['Course']['description']);?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">こんな方におすすめです</td><td class="courseTargetUser">
			<?php if (isset ($course['Course']['target_user'])):?>
				<?php echo nl2br($course['Course']['target_user']);?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">クラスの種類</td><td class="courseType">
			<?php if (isset ($type['CourseType']['type'])):?>
				<?php echo $type['CourseType']['type'];?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">カテゴリー</td><td class="courseCategory">
			<?php if (isset ($category['Category']['name'])):?>
				<?php echo $category['Category']['name'];?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">開催エリア</td><td class="courseArea">
			<?php if (isset ($area['Area']['name'])):?>
				<?php echo $area['Area']['name'];?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">クラスのタグ</td><td class="courseTag">
			<?php if (isset ($course['Course']['tag'])):?>
				<?php $tag = explode(",", $course['Course']['tag']);?>
				<ul class="confirmTags clearfix">
				<?php foreach ($tag as $row):?>
					<li><?php echo $row; ?></li>
				<?php endforeach;?>
				</ul>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left">参加費用</td><td class="coursePrice">
			<?php if (isset ($course['Course']['price'])):?>
				<?php echo $course['Course']['price'] . "円";?>
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="left" rowspan="3">クラス イメージ画像</td><td class="courseImage01">
			<?php if (isset ($course['Course']['course_image01']) && $image = $course['Course']['course_image01']):?>
				<?php echo $this->Html->image(Configure::read('Course.upload_path_prefix').$image);?>
			<?php else:?>
				画像が選択されていません
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="courseImage02">
			<?php if (isset ($course['Course']['course_image02']) && $image = $course['Course']['course_image02']):?>
				<?php echo $this->Html->image(Configure::read('Course.upload_path_prefix').$image);?>
			<?php else:?>
				画像が選択されていません
			<?php endif;?>
		</td>
	</tr>
	<tr>
		<td class="courseImage03">
			<?php if (isset ($course['Course']['course_image03']) && $image = $course['Course']['course_image03']):?>
				<?php echo $this->Html->image(Configure::read('Course.upload_path_prefix').$image);?>
			<?php else:?>
				画像が選択されていません
			<?php endif;?>
		</td>
	</tr>
	<?php // if confirm for edit , show submit here \
	if(!isset($course['CourseDetail'])): ?>
	<tr>
		<td colspan="2" class="submit">
			<?php echo $this->Form->submit('btn_create_course_off.png', array('div' => false, 'class' => 'btnSubmit'));?>&nbsp;
			<?php echo $this->Form->submit('btn_cancel_off.png', array('div' => false, 'class' => 'jsBtnBack', 'id' => 'courseReset'));?>
		</td>
	</tr>
	<?php endif; ?>
</table>

<?php if(isset($course['CourseDetail']) && count($course['CourseDetail']) > 0): ?>
<h1 class="subTitle add">スケジュールを追加する</h1>
<table class="scheduleForm">
	<tr>
		<td class="left"><label for="year">名前</label></td>
		<td>
			<dl>
				<dd>開催日</dd>
				<dt id="confirm_date">
				<?php echo date('Y / m / d', strtotime($course['CourseDetail']['opening_date'])); 
				?>
				</dt>
				<dd>開催時間</dd>
				<dt id="confirm_hour">
				<?php echo date('H:i', strtotime($course['CourseDetail']['opening_date'])). ' - '. date('H:i', strtotime($course['CourseDetail']['closing_date'])); ?>
				</dt>
			</dl>
		</td>
	</tr>
	<tr>
		<td class="left">開催場所<br/>キャッチコピー</td>
		<td>
			<dl>
				<dd>エリア</dd>
				<dt id="confirm_area"><?php if(isset($areaCoureDetail['Area']['name'])){ echo $areaCoureDetail['Area']['name'];} ?>
				</dt>
				<dd>郵便番号</dd>
				<dt id="confirm_zipcode">〒 <?php echo $course['CourseDetail']['zip01'] . ' - ' . $course['CourseDetail']['zip02']; ?>
				</dt>
				<dd>市区町村</dd>
				<dt id="confirm_city"><?php echo htmlspecialchars($course['CourseDetail']['address01']);?>
				</dt>
				<dd>番地・建物名</dd>
				<dt id="confirm_address"><?php echo htmlspecialchars($course['CourseDetail']['address02']);?>
				</dt>
				<dd>開催場所名</dd>
				<dt id="confirm_place"><?php echo htmlspecialchars($course['CourseDetail']['place_name']);?>
				</dt>
				<dd>開催地公開設定</dd>
				<dt id="confirm_address_display">
				<?php if(isset($course['CourseDetail']['address_flg']) && $course['CourseDetail']['address_flg'] == '1'):
					echo '全員に公開';
				else:
					echo '予約者のみ公開';
				endif; ?>
				</dt>
			</dl>
		</td>
	</tr>
	<tr>
		<td class="left"><label for="attendTotal">参加内容詳細</label></td>
		<td>
			<dl>
				<dd><label for="attendTotal">最大参加人数</label></dd>
				<dt id="confirm_attend_total"><?php echo $course['CourseDetail']['attend_total']; ?></dt>
				<dd><label for="price">参加費用</label></dd>
				<dt id="confirm_price"><?php echo $course['CourseDetail']['price'] ;?></dt>
			</dl>
		</td>
	</tr>
	<tr>
		<td class="left"><label for="notice">その他 表記事項</label></td>
		<td id="confirm_notice"><?php echo substr($course['CourseDetail']['notice'], 0, 100) ;?>
		</td>
	</tr>
	<tr>
		<td colspan="2" class="submit">
			<?php echo $this->Form->submit('btn_create_course_off.png', array('div' => false, 'class' => 'btnSubmit'));?>&nbsp;
			<?php echo $this->Form->submit('btn_cancel_off.png', array('div' => false, 'class' => 'jsBtnBack', 'id' => 'courseReset'));?>
		</td>
	</tr>
</table>
	<?php endif; ?>